package com.zenaprod.zenda.map;


import com.zenaprod.twodcore.graphic.element.Element;

import javax.swing.*;
import java.awt.*;
import java.util.Observable;
import java.util.Observer;

public class MapView extends JPanel implements Observer {
    private MapModel mapModel;

    public MapView(MapModel mapModel) {
        super();
        this.mapModel = mapModel;
    }

    public void setModel(MapModel mapModel) {
        this.mapModel = mapModel;
        repaint();
    }


    public void paintComponent(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        for(Element element : mapModel.getElements()) {
//            element.draw(g2D);
        }
    }


    public void update(Observable o, Object arg) {
        if(o instanceof MapModel) {
            repaint();
        }
    }
}
